package ca.usherbrooke.application.astar;

import ca.usherbrooke.application.astar.action.AStarMoveAction;

public class Successeur {

	private final Etat etat;
	private final Float cout;
	private final AStarMoveAction action;

	/**
	 * @param etat
	 * @param cout
	 * @param action
	 */
	public Successeur(Etat etat, Float cout, AStarMoveAction action) {
		super();
		this.etat = etat;
		this.cout = cout;
		this.action = action;
	}

	public Etat getEtat() {
		return etat;
	}

	public Float getCout() {
		return cout;
	}

	public AStarMoveAction getAction() {
		return action;
	}

	@Override
	public String toString() {
		return etat.toString();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((etat == null) ? 0 : etat.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Successeur other = (Successeur) obj;
		if (etat == null) {
			if (other.etat != null)
				return false;
		} else if (!etat.equals(other.etat))
			return false;
		return true;
	}
}
